package thread;

import static java.lang.Thread.sleep;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: SEKI TOMOKI
 * Date: 2025-01-13
 * Time: 11:35
 */
public class ThreadDemo8 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()-> {
            //这个线程的运行时间大概是 1s
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        System.out.println("start之前：" + t.isAlive());
        t.start();
        System.out.println("start之后：" + t.isAlive());

        Thread.sleep(2000);
        // 2s之后线程 t 已经结束了
        System.out.println("t 结束之后：" + t.isAlive());
    }

}
